<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function selectAll(){
				chks=document.getElementsByName("hobby");
				for(var i in chks){
					chks[i].checked=chkAll.checked;
				}
			}
		</script>
	</head>
	<body>
		全选:<input type="checkbox" id="chkAll" onchange="selectAll()" /><br />
		足球:<input type="checkbox" name="hobby" value="football"  />
		篮球:<input type="checkbox" name="hobby" value="basketball"  />
		游泳:<input type="checkbox" name="hobby" value="swimming"  />
	</body>
</html>
